﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;

namespace GameTank
{
    public class GamePlay : Form
    {
        public GamePlay()
        {
        }

        public void LoadNewGame(ContentManager content, MapDTO map)
        {
            foreach (var character in map.CharacterDTOs)
            {
                Character newCharacter = new Character(character, content);
                this.Childs.Add(newCharacter);
            }

            foreach (var construction in map.ConstructionsDTOs)
            {
                Construction con = new Construction(construction,content);
                this.Childs.Add(con);
            }
        }

        bool checkAlive(List<string> listName)
        {
            bool kq = false;
            foreach (var name in listName)
            {
                foreach (var temp in Childs)
                { 
                    if (temp is Character)
                    {
                        if (((Character)temp).Detail.Name == name)
                        {
                            return true;
                        }                        
                    }
                }
            }
            return kq;
        }

        bool checkDead(List<string> listName)
        {
            bool kq = true;
            foreach (var name in listName)
            {
                foreach (var temp in Childs)
                {
                    if (temp is Character)
                    {
                        if (((Character)temp).Detail.Name == name)
                        {
                            return false;
                        }
                    }
                }
            }
            return kq;
        }
    }
}
